package concurrency2;

/**
 * @Author: DRevelation
 * @Date: 2021/2/5 16:30
 */
public class ThreadGroupDemo {

    public static void main(String[] args) {
        ThreadGroup threadGroup = new ThreadGroup("group1") {
            @Override
            public void uncaughtException(Thread t, Throwable e) {
                System.out.println(t.getName() + ": " + e.getMessage());
            }
        };

        Thread thread1 = new Thread(threadGroup, new Runnable() {
            @Override
            public void run() {
                throw new RuntimeException("测试异常");
            }
        });
        thread1.start();
    }

}
